﻿namespace System.Threading.Tasks.Dataflow
{
	using System.Runtime.CompilerServices;

	public class TaskRequest<TResult> : TaskCompletionSource<TResult>
	{
		public TaskRequest()
		{
		}

		public TaskRequest(TaskCreationOptions createOptions)
			: base(createOptions)
		{
		}

		public TaskAwaiter<TResult> GetTaskAwaiter()
		{
			return Task.GetAwaiter();
		}
	}

	public class TaskRequest<TMessage, TResult> : TaskRequest<TResult>
	{
		public TaskRequest()
		{
		}

		public TaskRequest(TaskCreationOptions createOptions)
			: base(createOptions)
		{
		}

		public TaskRequest(TMessage message)
		{
			Message = message;
		}

		public TaskRequest(TMessage message, TaskCreationOptions createOptions)
			: base(createOptions)
		{
			Message = message;
		}

		public TMessage Message
		{
			get;
			set;
		}
	}
}
